package com.stu.chart.util;

import java.util.HashMap;

/**
 * @author dsj
 */
public class Rvo extends HashMap<String, Object> {
    public static Rvo ok() {
        return createRvo(200, null, null);
    }

    public static Rvo ok(String msg) {
        return createRvo(200, msg, null);
    }
    public static Rvo ok(String msg,Object data) {
        return createRvo(200, msg, data);
    }

    public static Rvo createRvo(Integer code, String msg, Object data) {
        Rvo rvo = new Rvo();
        rvo.put("code", code);
        rvo.put("message", msg);
        rvo.put("data", data);
        return rvo;
    }

    public static Rvo ok(Object data) {
        return createRvo(200, null, data);
    }

    public static Rvo error(String msg) {
        return createRvo(500, msg, null);
    }
}
